//
//  DragView.m
//  Touch
//
//  Created by cocoazxj@163.com on 15/4/20.
//  Copyright (c) 2015年 handcool. All rights reserved.
//

#import "DragView.h"

@implementation DragView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//    UITouch *t = [touches anyObject];
    
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *t = [touches anyObject];
    CGPoint currentmove = [t locationInView:self];
    CGPoint premove = [t previousLocationInView:self];
    
    CGFloat moveX = currentmove.x - premove.x;
    CGFloat moveY = currentmove.y - premove.y;
    
    CGPoint point = self.center;
    point.x += moveX;
    point.y += moveY;
    self.center = point;
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    
}
@end
